<div id="paginationControl">
    {{if isset($paging)}}
    {{if $paging['total-item']>$paging['item-per-page']}}
    <ul>
        {{if $paging['cur-page']==1}}
            <li><a href="javascript:;" class="active">Đầu</a></li>
            <li><a href="javascript:;" class="active">&laquo;Trước</a></li>
        {{else}}
            <li><a href="javascript:;" onclick="pagination('1');" class="active">&laquo;Đầu</a></li>
            <li><a href="javascript:;" onclick="pagination('{{$paging['cur-page']-1}}');" class="active">&laquo;Trước</a></li>
        {{/if}}
        
        {{$startpage=$paging['cur-page']-4}} {{if $startpage<0}}{{$startpage=1}}{{/if}}
        {{$page=1}}
        {{for $i=1 to $paging['total-item'] step $paging['item-per-page']}}
        {{if $page<=$startpage+5 and $page>=$startpage}}
            <li><a href="javascript:;" onclick="pagination('{{$page}}');" class="{{if $paging['cur-page']==$page}}active{{/if}}">{{$page}}</a></li>
        {{/if}}
        {{$page=$page+1}}
        {{/for}}
        
        {{if $paging['cur-page'] == $page-1}}
            <li><a href="javascript:;" class="active">Tiếp»</a></li>
            <li><a href="javascript:;" class="active">Cuối</a></li>
        {{else}}
            <li><a href="javascript:;" onclick="pagination('{{$paging['cur-page']+1}}');" class="active">Tiếp»</a></li>
            <li><a href="javascript:;" onclick="pagination('{{$page-1}}');" class="active">Cuối</a></li>
        {{/if}}
    </ul>
    {{/if}}
    {{/if}}
</div>
